package com.esunrising.esungsc.common.utils;
import java.time.LocalDateTime;

import com.alibaba.fastjson.JSONObject;
import com.esunrising.esungsc.entity.*;

public final class ESUNGSCUtil {

    private ESUNGSCUtil(){

    }

    /**
     * 由Json对象解析GSC账务凭证库对象
     * @param jsonObject Json对象
     * @return GSC账务凭证库对象
     */
    public static FIGLAccountingDocument jsonObject2FIGLAccountingDocument(JSONObject jsonObject){

        FIGLAccountingDocument accDoc = new FIGLAccountingDocument();

        accDoc.setID(jsonObject.getString("ID"));
        accDoc.setAbstracts(jsonObject.getString("ABSTRACTS"));
        accDoc.setAccDocCode(jsonObject.getString("ACCDOCCODE"));
        accDoc.setAccDocDate(jsonObject.getString("ACCDOCDATE"));
        accDoc.setAccDocTypeID(jsonObject.getString("ACCDOCTYPEID"));
        accDoc.setAccManagerID(jsonObject.getString("ACCMANAGERID"));
        accDoc.setAccManagerName(jsonObject.getString("ACCMANAGERNAME"));
        accDoc.setAccOrgID(jsonObject.getString("ACCORGID"));
        accDoc.setDwbh(jsonObject.getString("DWBH"));
        accDoc.setLedger(jsonObject.getString("LEDGER"));
        accDoc.setAccPeriodCode(jsonObject.getString("ACCPERIODCODE"));
        accDoc.setAccPeriodID(jsonObject.getString("ACCPERIODID"));
        accDoc.setAmount(jsonObject.getDouble("AMOUNT"));
        accDoc.setApproverID(jsonObject.getString("APPROVERID"));
        accDoc.setApproverName(jsonObject.getString("APPROVERNAME"));
        accDoc.setAuditor(jsonObject.getString("AUDITOR"));
        accDoc.setAuditorName(jsonObject.getString("AUDITORNAME"));
        accDoc.setBookerID(jsonObject.getString("BOOKERID"));
        accDoc.setBookerName(jsonObject.getString("BOOKERNAME"));
        accDoc.setCashierID(jsonObject.getString("CASHIERID"));
        accDoc.setCashierName(jsonObject.getString("CASHIERNAME"));
        accDoc.setNumberOfAttch(jsonObject.getInteger("NUMBEROFATTCH"));
        accDoc.setMakerCode(jsonObject.getString("MAKERCODE"));
        accDoc.setMakerID(jsonObject.getString("MAKERID"));
        accDoc.setMakerName(jsonObject.getString("MAKERNAME"));
        accDoc.setOperatorID(jsonObject.getString("OPERATORID"));
        accDoc.setOperatorName(jsonObject.getString("OPERATORNAME"));
        accDoc.setIsApproved(jsonObject.getString("ISAPPROVED"));
        accDoc.setIsAudit(jsonObject.getString("ISAUDIT"));
        accDoc.setIsBook(jsonObject.getString("ISBOOK"));
        accDoc.setIsComplete(jsonObject.getString("ISCOMPLETE"));
        accDoc.setIsVoid(jsonObject.getString("ISVOID"));
        accDoc.setSourceClass(jsonObject.getString("SOURCECLASS"));
        accDoc.setYear(jsonObject.getString("YEAR"));
        accDoc.setTimestampCreatedOn(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_CREATEDON")));
        accDoc.setTimestampLastChangedOn(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_LASTCHANGEDON")));

        return accDoc;
    }

    /**
     * 由Json对象解析GSC账务凭证分录对象
     * @param jsonObject Json对象
     * @return GSC账务凭证分录对象
     */
    public static FIGLAccDocEntry jsonObject2FIGLAccDocEntry(JSONObject jsonObject) {
        FIGLAccDocEntry figlAccDocEntry = new FIGLAccDocEntry();

        figlAccDocEntry.setID(jsonObject.getString("ID"));
        figlAccDocEntry.setAbstracts(jsonObject.getString("ABSTRACTS"));
        figlAccDocEntry.setAccDocID(jsonObject.getString("ACCDOCID"));
        figlAccDocEntry.setAccEntryCode(jsonObject.getString("ACCENTRYCODE"));
        figlAccDocEntry.setAccOrgID(jsonObject.getString("ACCORGID"));
        figlAccDocEntry.setDwbh(jsonObject.getString("DWBH"));
        figlAccDocEntry.setLedger(jsonObject.getString("LEDGER"));
        figlAccDocEntry.setAccTitleCode(jsonObject.getString("ACCTITLECODE"));
        figlAccDocEntry.setAccTitleID(jsonObject.getString("ACCTITLEID"));
        figlAccDocEntry.setAccTGType(jsonObject.getString("ACCTGTYPE"));
        figlAccDocEntry.setAmount(jsonObject.getDouble("AMOUNT"));
        figlAccDocEntry.setBizDate(jsonObject.getString("BIZDATE"));
        figlAccDocEntry.setCurrencyID(jsonObject.getString("CURRENCYID"));
        figlAccDocEntry.setEndEntry(jsonObject.getString("ENDENTRY"));
        figlAccDocEntry.setExchangeRate(jsonObject.getDouble("EXCHANGERATE"));
        figlAccDocEntry.setForeignCurrency(jsonObject.getDouble("FOREIGNCURRENCY"));
        figlAccDocEntry.setIsAccountCheck(jsonObject.getString("ISACCOUNTCHECK"));
        figlAccDocEntry.setQuantity(jsonObject.getDouble("QUANTITY"));
        figlAccDocEntry.setLendingDirection(jsonObject.getString("LENDINGDIRECTION"));
        figlAccDocEntry.setSettlement(jsonObject.getString("SETTLEMENT"));
        figlAccDocEntry.setSettlementNumber(jsonObject.getString("SETTLEMENTNUMBER"));
        figlAccDocEntry.setUnitPrice(jsonObject.getDouble("UNITPRICE"));
        figlAccDocEntry.setYear(jsonObject.getString("YEAR"));
        figlAccDocEntry.setTimestampCreatedOn(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_CREATEDON")));
        figlAccDocEntry.setTimestampLastChangedOn(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_LASTCHANGEDON")));


        return figlAccDocEntry;
    }

    /**
     * 由Json对象解析GSC账务凭证辅助原始对象
     * @param jsonObject Json对象
     * @return GSC账务凭证辅助原始对象
     */
    public static FIGLAccDocAssistance jsonObject2FIGLAccDocAssistance(JSONObject jsonObject) {
        FIGLAccDocAssistance figlAccDocAssistance = new FIGLAccDocAssistance();

        figlAccDocAssistance.setID(jsonObject.getString("ID"));
        figlAccDocAssistance.setAccDocID(jsonObject.getString("ACCDOCID"));
        figlAccDocAssistance.setAccDocEntryID(jsonObject.getString("ACCDOCENTRYID"));
        figlAccDocAssistance.setAccAssCode(jsonObject.getString("ACCASSCODE"));
        figlAccDocAssistance.setAccOrgID(jsonObject.getString("ACCORGID"));
        figlAccDocAssistance.setDwbh(jsonObject.getString("DWBH"));
        figlAccDocAssistance.setLedger(jsonObject.getString("LEDGER"));
        figlAccDocAssistance.setAccTitleCode(jsonObject.getString("ACCTITLECODE"));
        figlAccDocAssistance.setAccTitleID(jsonObject.getString("ACCTITLEID"));
        figlAccDocAssistance.setLendingDirection(jsonObject.getString("LENDINGDIRECTION"));
        figlAccDocAssistance.setAccEmployeeID(jsonObject.getString("ACCEMPLOYEEID"));
        figlAccDocAssistance.setDeptID(jsonObject.getString("DEPTID"));
        figlAccDocAssistance.setRelatedOrgID(jsonObject.getString("RELATEDORGID"));
        figlAccDocAssistance.setRelatedOrgVersion(jsonObject.getInteger("RELATEDORGVERSION"));
        figlAccDocAssistance.setQuantity(jsonObject.getDouble("QUANTITY"));
        figlAccDocAssistance.setUnitPrice(jsonObject.getDouble("UNITPRICE"));
        figlAccDocAssistance.setExchangeRate(jsonObject.getDouble("EXCHANGERATE"));
        figlAccDocAssistance.setAmount(jsonObject.getDouble("AMOUNT"));
        figlAccDocAssistance.setForeignCurrency(jsonObject.getDouble("FOREIGNCURRENCY"));
        figlAccDocAssistance.setForeignCurrencyID(jsonObject.getString("FOREIGNCURRENCYID"));
        figlAccDocAssistance.setWbbh(jsonObject.getString("WBBH"));
        figlAccDocAssistance.setBizDate(jsonObject.getString("BIZDATE"));
        figlAccDocAssistance.setBizCode(jsonObject.getString("BIZCODE"));
        figlAccDocAssistance.setOperator(jsonObject.getString("OPERATOR"));
        figlAccDocAssistance.setBillNumber(jsonObject.getString("BILLNUMBER"));
        figlAccDocAssistance.setSettlement(jsonObject.getString("SETTLEMENT"));
        figlAccDocAssistance.setSettlementNumber(jsonObject.getString("SETTLEMENTNUMBER"));
        figlAccDocAssistance.setSettlementDate(jsonObject.getString("SETTLEMENTDATE"));
        figlAccDocAssistance.setApplication(jsonObject.getString("APPLICATION"));
        figlAccDocAssistance.setSpeCateID01(jsonObject.getString("SPECATEID01"));
        figlAccDocAssistance.setSpeCateID02(jsonObject.getString("SPECATEID02"));
        figlAccDocAssistance.setSpeCateID03(jsonObject.getString("SPECATEID03"));
        figlAccDocAssistance.setSpeCateID04(jsonObject.getString("SPECATEID04"));
        figlAccDocAssistance.setSpeCateID05(jsonObject.getString("SPECATEID05"));
        figlAccDocAssistance.setSpeCateID06(jsonObject.getString("SPECATEID06"));
        figlAccDocAssistance.setSpeCateID07(jsonObject.getString("SPECATEID07"));
        figlAccDocAssistance.setSpeCateID08(jsonObject.getString("SPECATEID08"));
        figlAccDocAssistance.setSpeCateID09(jsonObject.getString("SPECATEID09"));
        figlAccDocAssistance.setSpeCateID10(jsonObject.getString("SPECATEID10"));
        figlAccDocAssistance.setSpeCateID11(jsonObject.getString("SPECATEID11"));
        figlAccDocAssistance.setSpeCateID99(jsonObject.getString("SPECATEID99"));
        figlAccDocAssistance.setBizDictCateID01(jsonObject.getString("BIZDICTCATEID01"));
        figlAccDocAssistance.setBizDictCateID02(jsonObject.getString("BIZDICTCATEID02"));
        figlAccDocAssistance.setBizDictCateID03(jsonObject.getString("BIZDICTCATEID03"));
        figlAccDocAssistance.setBizDictCateID04(jsonObject.getString("BIZDICTCATEID04"));
        figlAccDocAssistance.setBizDictCateID05(jsonObject.getString("BIZDICTCATEID05"));
        figlAccDocAssistance.setBizDictCateID06(jsonObject.getString("BIZDICTCATEID06"));
        figlAccDocAssistance.setBizDictCateID07(jsonObject.getString("BIZDICTCATEID07"));
        figlAccDocAssistance.setBizDictCateID08(jsonObject.getString("BIZDICTCATEID08"));
        figlAccDocAssistance.setBizDictCateID09(jsonObject.getString("BIZDICTCATEID09"));
        figlAccDocAssistance.setBizDictCateID10(jsonObject.getString("BIZDICTCATEID10"));
        figlAccDocAssistance.setSm01(jsonObject.getString("SM01"));
        figlAccDocAssistance.setSm02(jsonObject.getString("SM02"));
        figlAccDocAssistance.setSm03(jsonObject.getString("SM03"));
        figlAccDocAssistance.setSm04(jsonObject.getString("SM04"));
        figlAccDocAssistance.setSm05(jsonObject.getString("SM05"));
        figlAccDocAssistance.setSm06(jsonObject.getString("SM06"));
        figlAccDocAssistance.setSm07(jsonObject.getString("SM07"));
        figlAccDocAssistance.setSm08(jsonObject.getString("SM08"));
        figlAccDocAssistance.setSm09(jsonObject.getString("SM09"));
        figlAccDocAssistance.setSm10(jsonObject.getString("SM10"));
        figlAccDocAssistance.setYear(jsonObject.getString("YEAR"));
        figlAccDocAssistance.setTimestampCreatedOn(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_CREATEDON")));
        figlAccDocAssistance.setTimestampLastChangedOn(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_LASTCHANGEDON")));


        return figlAccDocAssistance;
    }

    /**
     * 由Json对象解析GSC凭证关联业务单据对象
     * @param jsonObject Json对象
     * @return GSC凭证关联业务单据对象
     */
    public static FIGLAYwdj jsonObject2FIGLAYwdj(JSONObject jsonObject) {
        FIGLAYwdj figlaYwdj = new FIGLAYwdj();

        figlaYwdj.setId(jsonObject.getString("ID"));
        figlaYwdj.setAccorg(jsonObject.getString("ACCORG"));
        figlaYwdj.setAccdocyear(jsonObject.getString("ACCDOCYEAR"));
        figlaYwdj.setAccdocdate(jsonObject.getString("ACCDOCDATE"));
        figlaYwdj.setAccdocnumber(jsonObject.getString("ACCDOCNUMBER"));
        figlaYwdj.setAccledger(jsonObject.getString("ACCLEDGER"));
        figlaYwdj.setBizdataid(jsonObject.getString("BIZDATAID"));
        figlaYwdj.setDjbh(jsonObject.getString("DJBH"));
        figlaYwdj.setBizdatatype(jsonObject.getString("BIZDATATYPE"));
        figlaYwdj.setTargetdatatype(jsonObject.getString("TARGETDATATYPE"));
        figlaYwdj.setTargetdataid(jsonObject.getString("TARGETDATAID"));
        figlaYwdj.setYwlxname(jsonObject.getString("YWLXNAME"));
        figlaYwdj.setYwlxcode(jsonObject.getString("YWLXCODE"));

        return figlaYwdj;
    }

    /**
     * 由Json对象解析GSC账务核算项目字典对象
     * @param jsonObject Json对象
     * @return GSC账务核算项目字典对象
     */
    public static BFCustomItem jsonObject2BFCustomItem(JSONObject jsonObject) {
        BFCustomItem customItem = new BFCustomItem();
        customItem.setID(jsonObject.getString("ID"));
        customItem.setAccountOrg(jsonObject.getString("ACCOUNTORG"));
        customItem.setAllowAddLower(jsonObject.getString("ALLOWADDLOWER"));
        customItem.setCompleteDate(jsonObject.getString("COMPLETEDATE"));
        customItem.setCusItemCategory(jsonObject.getString("CUSITEMCATEGORY"));
        customItem.setTypeCode(jsonObject.getString("TYPECODE"));
        customItem.setTypeName(jsonObject.getString("TYPENAME"));
        customItem.setCusItemCode(jsonObject.getString("CUSITEMCODE"));
        customItem.setCusItemFullName(jsonObject.getString("CUSITEMFULLNAME_CHS"));
        customItem.setCusItemName(jsonObject.getString("CUSITEMNAME_CHS"));
        customItem.setCusItemProperty(jsonObject.getString("CUSITEMPROPERTY"));
        customItem.setFiYear(jsonObject.getString("FIYEAR"));
        customItem.setIsCompleted(jsonObject.getString("ISCOMPLETED"));
        customItem.setIsDisabled(jsonObject.getString("ISDISABLED"));
        customItem.setOrgCode(jsonObject.getString("ORGCODE"));
        customItem.setOrgName(jsonObject.getString("ORGNAME"));
        customItem.setParentID(jsonObject.getString("PARENTID"));
        customItem.setPaarentTreeInfoPath(jsonObject.getString("PARENT_TREEINFO_PATH"));
        customItem.setSecurityLevel(jsonObject.getString("SECURITYLEVEL"));
        customItem.setTreeInfoIsDetail(jsonObject.getString("TREEINFO_ISDETAIL"));
        customItem.setTreeInfoLayer(jsonObject.getInteger("TREEINFO_LAYER"));
        customItem.setTreeInfoPath(jsonObject.getString("TREEINFO_PATH"));
        customItem.setTimestampCreatedOn(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_CREATEDON")));
        customItem.setTimestampLastChangedOn(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_LASTCHANGEDON")));



        return customItem;

    }

    /**
     * 由Json对象解析核算账簿对象
     * @param jsonObject Json对象
     * @return 核算账簿对象
     */
    public static ApiHsdw jsonObject2ApiHsdw(JSONObject jsonObject) {
        ApiHsdw apiHsdw = new ApiHsdw();

        apiHsdw.setId(jsonObject.getString("ID"));
        apiHsdw.setCode(jsonObject.getString("CODE"));
        apiHsdw.setAccorgid(jsonObject.getString("ACCORGID"));
        apiHsdw.setAcctype(jsonObject.getString("ACCTYPE"));
        apiHsdw.setAccproperty(jsonObject.getString("ACCPROPERTY"));
        apiHsdw.setAccorgidAdminorgid(jsonObject.getString("ACCORGID_ADMINORGID"));
        apiHsdw.setAccorgidAdminorgcode(jsonObject.getString("ACCORGID_ADMINORGCODE"));
        apiHsdw.setAccorgidAdminorgname(jsonObject.getString("ACCORGID_ADMINORGNAME"));
        apiHsdw.setTimestampCreatedon(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_CREATEDON")));
        apiHsdw.setTimestampLastchangedon(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_LASTCHANGEDON")));
        apiHsdw.setDisableyear(jsonObject.getString("DISABLEYEAR"));
        apiHsdw.setEnableflag(jsonObject.getString("ENABLEFLAG"));
        apiHsdw.setIsdisable(jsonObject.getString("ISDISABLE"));
        apiHsdw.setNameChs(jsonObject.getString("NAME_CHS"));
        apiHsdw.setOrgcode(jsonObject.getString("ORGCODE"));
        apiHsdw.setOrgname(jsonObject.getString("ORGNAME"));

        return  apiHsdw;
    }

    public static TApiKmsx jsonObject2ApiKmsx(JSONObject jsonObject) {
        TApiKmsx tApiKmsx = new TApiKmsx();

        tApiKmsx.setId(jsonObject.getString("ID"));
        tApiKmsx.setCode(jsonObject.getString("CODE"));
        tApiKmsx.setFiyear(jsonObject.getString("FIYEAR"));
        tApiKmsx.setAccounttype(jsonObject.getString("ACCOUNTTYPE"));
        tApiKmsx.setIsoutstatement(jsonObject.getString("ISOUTSTATEMENT"));
        tApiKmsx.setAcctitlefirstchar(jsonObject.getString("ACCTITLEFIRSTCHAR"));
        tApiKmsx.setAccounttitletype(jsonObject.getString("ACCOUNTTITLETYPE"));
        tApiKmsx.setNameEs(jsonObject.getString("NAME_ES"));
        tApiKmsx.setTimestampLastchangedon(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_LASTCHANGEDON")));
        tApiKmsx.setChartofaccount(jsonObject.getString("CHARTOFACCOUNT"));
        tApiKmsx.setNameEn(jsonObject.getString("NAME_EN"));
        tApiKmsx.setNameChs(jsonObject.getString("NAME_CHS"));
        tApiKmsx.setTimestampCreatedby(jsonObject.getString("TIMESTAMP_CREATEDBY"));
        tApiKmsx.setNameCht(jsonObject.getString("NAME_CHT"));
        tApiKmsx.setNamePt(jsonObject.getString("NAME_PT"));
        tApiKmsx.setTimestampLastchangedby(jsonObject.getString("TIMESTAMP_LASTCHANGEDBY"));
        tApiKmsx.setBalancedir(jsonObject.getString("BALANCEDIR"));
        tApiKmsx.setTimestampCreatedon(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_CREATEDON")));

        return tApiKmsx;
    }

    public static TApiKmtx jsonObject2ApiKmtx(JSONObject jsonObject) {
        TApiKmtx tApiKmtx = new TApiKmtx();

        tApiKmtx.setId(jsonObject.getString("ID"));
        tApiKmtx.setTreeinfoIsdetail(jsonObject.getString("TREEINFO_ISDETAIL"));
        tApiKmtx.setFiyear(jsonObject.getString("FIYEAR"));
        tApiKmtx.setTreeinfoLayer(jsonObject.getString("TREEINFO_LAYER"));
        tApiKmtx.setNameEs(jsonObject.getString("NAME_ES"));
        tApiKmtx.setTimestampLastchangedon(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_LASTCHANGEDON")));
        tApiKmtx.setTreeinfoPath(jsonObject.getString("TREEINFO_PATH"));
        tApiKmtx.setCode(jsonObject.getString("CODE"));
        tApiKmtx.setTopparentid(jsonObject.getString("TOPPARENTID"));
        tApiKmtx.setNameEn(jsonObject.getString("NAME_EN"));
        tApiKmtx.setNameChs(jsonObject.getString("NAME_CHS"));
        tApiKmtx.setTimestampCreatedby(jsonObject.getString("TIMESTAMP_CREATEDBY"));
        tApiKmtx.setParentid(jsonObject.getString("PARENTID"));
        tApiKmtx.setNameCht(jsonObject.getString("NAME_CHT"));
        tApiKmtx.setNamePt(jsonObject.getString("NAME_PT"));
        tApiKmtx.setTimestampLastchangedby(jsonObject.getString("TIMESTAMP_LASTCHANGEDBY"));
        tApiKmtx.setTimestampCreatedon(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_CREATEDON")));
        tApiKmtx.setCodestruct(jsonObject.getString("CODESTRUCT"));

        return tApiKmtx;
    }

    public static TApiKm jsonObject2ApiKm(JSONObject jsonObject) {
        TApiKm tApiKm = new TApiKm();

        tApiKm.setCashacctitle(jsonObject.getDouble("CASHACCTITLE"));
        tApiKm.setNameEs(jsonObject.getString("NAME_ES"));
        tApiKm.setTimestampLastchangedon(jsonObject.getString("TIMESTAMP_LASTCHANGEDON"));
        tApiKm.setSrctype(jsonObject.getDouble("SRCTYPE"));
        tApiKm.setTimestampCreatedby(jsonObject.getString("TIMESTAMP_CREATEDBY"));
        tApiKm.setTitlename(jsonObject.getString("TITLENAME"));
        tApiKm.setTimestampLastchangedby(jsonObject.getString("TIMESTAMP_LASTCHANGEDBY"));
        tApiKm.setAuthflag(jsonObject.getString("AUTHFLAG"));
        tApiKm.setChartofacc(jsonObject.getString("CHARTOFACC"));
        tApiKm.setFullnamerole(jsonObject.getDouble("FULLNAMEROLE"));
        tApiKm.setId(jsonObject.getString("ID"));
        tApiKm.setTimestampCreatedon(jsonObject.getString("TIMESTAMP_CREATEDON"));
        tApiKm.setLedgercode(jsonObject.getString("LEDGERCODE"));
        tApiKm.setFiyear(jsonObject.getString("FIYEAR"));
        tApiKm.setExtendchar15(jsonObject.getString("EXTENDCHAR15"));
        tApiKm.setExtendchar14(jsonObject.getString("EXTENDCHAR14"));
        tApiKm.setExtendnum03(jsonObject.getDouble("EXTENDNUM03"));
        tApiKm.setLedgername(jsonObject.getString("LEDGERNAME"));
        tApiKm.setExtendchar13(jsonObject.getString("EXTENDCHAR13"));
        tApiKm.setExtendnum02(jsonObject.getDouble("EXTENDNUM02"));
        tApiKm.setExtendchar12(jsonObject.getString("EXTENDCHAR12"));
        tApiKm.setExtendnum01(jsonObject.getDouble("EXTENDNUM01"));
        tApiKm.setExtendchar11(jsonObject.getString("EXTENDCHAR11"));
        tApiKm.setMnemoniccode(jsonObject.getString("MNEMONICCODE"));
        tApiKm.setTreeinfoPath(jsonObject.getString("TREEINFO_PATH"));
        tApiKm.setOrgcode(jsonObject.getString("ORGCODE"));
        tApiKm.setIsbankbook(jsonObject.getString("ISBANKBOOK"));
        tApiKm.setNameEn(jsonObject.getString("NAME_EN"));
        tApiKm.setNameChs(jsonObject.getString("NAME_CHS"));
        tApiKm.setNameCht(jsonObject.getString("NAME_CHT"));
        tApiKm.setExtendchar10(jsonObject.getString("EXTENDCHAR10"));
        tApiKm.setBalancedir(jsonObject.getDouble("BALANCEDIR"));
        tApiKm.setExtendnum05(jsonObject.getDouble("EXTENDNUM05"));
        tApiKm.setExtendnum04(jsonObject.getDouble("EXTENDNUM04"));
        tApiKm.setExtendchar07(jsonObject.getString("EXTENDCHAR07"));
        tApiKm.setTreeinfoIsdetail(jsonObject.getString("TREEINFO_ISDETAIL"));
        tApiKm.setExtendchar06(jsonObject.getString("EXTENDCHAR06"));
        tApiKm.setExtendchar05(jsonObject.getString("EXTENDCHAR05"));
        tApiKm.setExtendchar04(jsonObject.getString("EXTENDCHAR04"));
        tApiKm.setExtendchar03(jsonObject.getString("EXTENDCHAR03"));
        tApiKm.setAccounttype(jsonObject.getDouble("ACCOUNTTYPE"));
        tApiKm.setExtendchar02(jsonObject.getString("EXTENDCHAR02"));
        tApiKm.setExtendchar01(jsonObject.getString("EXTENDCHAR01"));
        tApiKm.setOrgname(jsonObject.getString("ORGNAME"));
        tApiKm.setIsdisabled(jsonObject.getString("ISDISABLED"));
        tApiKm.setFullnamePt(jsonObject.getString("FULLNAME_PT"));
        tApiKm.setExtendchar09(jsonObject.getString("EXTENDCHAR09"));
        tApiKm.setExtendchar08(jsonObject.getString("EXTENDCHAR08"));
        tApiKm.setAuthlayer(jsonObject.getDouble("AUTHLAYER"));
        tApiKm.setIsallowledgerchildadd(jsonObject.getString("ISALLOWLEDGERCHILDADD"));
        tApiKm.setNamePt(jsonObject.getString("NAME_PT"));
        tApiKm.setAccorgid(jsonObject.getString("ACCORGID"));
        tApiKm.setAcctitleprop(jsonObject.getString("ACCTITLEPROP"));
        tApiKm.setRemark(jsonObject.getString("REMARK"));
        tApiKm.setIsjournalentry(jsonObject.getString("ISJOURNALENTRY"));
        tApiKm.setFullnameCht(jsonObject.getString("FULLNAME_CHT"));
        tApiKm.setFullnameChs(jsonObject.getString("FULLNAME_CHS"));
        tApiKm.setIsoutstatement(jsonObject.getString("ISOUTSTATEMENT"));
        tApiKm.setSrcid(jsonObject.getString("SRCID"));
        tApiKm.setTreeinfoLayer(jsonObject.getDouble("TREEINFO_LAYER"));
        tApiKm.setFullnameEn(jsonObject.getString("FULLNAME_EN"));
        tApiKm.setCode(jsonObject.getString("CODE"));
        tApiKm.setParentid(jsonObject.getString("PARENTID"));
        tApiKm.setTitlecode(jsonObject.getString("TITLECODE"));
        tApiKm.setLedger(jsonObject.getString("LEDGER"));
        tApiKm.setFullnameEs(jsonObject.getString("FULLNAME_ES"));
        tApiKm.setTypeflag(jsonObject.getDouble("TYPEFLAG"));

        return  tApiKm;

    }

    public static TApiXmlb jsonObject2ApiXmlb(JSONObject jsonObject) {
        TApiXmlb tApiXmlb = new TApiXmlb();

        tApiXmlb.setFiyear(jsonObject.getString("FIYEAR"));
        tApiXmlb.setCarryover(jsonObject.getString("CARRYOVER"));
        tApiXmlb.setIsauditcontrol(jsonObject.getString("ISAUDITCONTROL"));
        tApiXmlb.setDateauditid(jsonObject.getString("DATEAUDITID"));
        tApiXmlb.setAddbysetonpub(jsonObject.getString("ADDBYSETONPUB"));
        tApiXmlb.setFullnamestrategy(jsonObject.getString("FULLNAMESTRATEGY"));
        tApiXmlb.setCateproperty(jsonObject.getString("CATEPROPERTY"));
        tApiXmlb.setInvoice(jsonObject.getString("INVOICE"));
        tApiXmlb.setIssecuritycontrol(jsonObject.getString("ISSECURITYCONTROL"));
        tApiXmlb.setNameEs(jsonObject.getString("NAME_ES"));
        tApiXmlb.setIspartpub(jsonObject.getString("ISPARTPUB"));
        tApiXmlb.setTimestampLastchangedon(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_LASTCHANGEDON")));
        tApiXmlb.setCode(jsonObject.getString("CODE"));
        tApiXmlb.setNameEn(jsonObject.getString("NAME_EN"));
        tApiXmlb.setNameChs(jsonObject.getString("NAME_CHS"));
        tApiXmlb.setTimestampCreatedby(jsonObject.getString("TIMESTAMP_CREATEDBY"));
        tApiXmlb.setNameCht(jsonObject.getString("NAME_CHT"));
        tApiXmlb.setNamePt(jsonObject.getString("NAME_PT"));
        tApiXmlb.setTimestampLastchangedby(jsonObject.getString("TIMESTAMP_LASTCHANGEDBY"));
        tApiXmlb.setCodestruc(jsonObject.getString("CODESTRUC"));
        tApiXmlb.setId(jsonObject.getString("ID"));
        tApiXmlb.setAccorgid(jsonObject.getString("ACCORGID"));
        tApiXmlb.setTimestampCreatedon(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_CREATEDON")));

        return tApiXmlb;
    }

    public static TApiXm jsonObject2ApiXm(JSONObject jsonObject) {
        TApiXm tApiXm = new TApiXm();

        tApiXm.setPermissionclasses(jsonObject.getString("PERMISSIONCLASSES"));
        tApiXm.setCusitemnameCht(jsonObject.getString("CUSITEMNAME_CHT"));
        tApiXm.setCusitemnameChs(jsonObject.getString("CUSITEMNAME_CHS"));
        tApiXm.setSignature(jsonObject.getString("SIGNATURE"));
        tApiXm.setTimestampLastchangedon(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_LASTCHANGEDON")));
        tApiXm.setTimestampCreatedby(jsonObject.getString("TIMESTAMP_CREATEDBY"));
        tApiXm.setTimestampLastchangedby(jsonObject.getString("TIMESTAMP_LASTCHANGEDBY"));
        tApiXm.setCusitemproperty(jsonObject.getString("CUSITEMPROPERTY"));
        tApiXm.setId(jsonObject.getString("ID"));
        tApiXm.setTimestampCreatedon(ESUNUtil.date2LocalDateTime(jsonObject.getDate("TIMESTAMP_CREATEDON")));
        tApiXm.setAccountorg(jsonObject.getString("ACCOUNTORG"));
        tApiXm.setFiyear(jsonObject.getString("FIYEAR"));
        tApiXm.setTypename(jsonObject.getString("TYPENAME"));
        tApiXm.setAllowaddlower(jsonObject.getString("ALLOWADDLOWER"));
        tApiXm.setMnemoniccode(jsonObject.getString("MNEMONICCODE"));
        tApiXm.setTreeinfoPath(jsonObject.getString("TREEINFO_PATH"));
        tApiXm.setOrgcode(jsonObject.getString("ORGCODE"));
        tApiXm.setIscompleted(jsonObject.getString("ISCOMPLETED"));
        tApiXm.setTreeinfoIsdetail(jsonObject.getString("TREEINFO_ISDETAIL"));
        tApiXm.setOrgname(jsonObject.getString("ORGNAME"));
        tApiXm.setIsdisabled(jsonObject.getString("ISDISABLED"));
        tApiXm.setParentTreeinfoPath(jsonObject.getString("PARENT_TREEINFO_PATH"));
        tApiXm.setSecuritylevel(jsonObject.getString("SECURITYLEVEL"));
        tApiXm.setCompletedate(jsonObject.getString("COMPLETEDATE"));
        tApiXm.setCusitemcode(jsonObject.getString("CUSITEMCODE"));
        tApiXm.setTreeinfoLayer(jsonObject.getString("TREEINFO_LAYER"));
        tApiXm.setCusitemfullnameChs(jsonObject.getString("CUSITEMFULLNAME_CHS"));
        tApiXm.setPermissionflag(jsonObject.getString("PERMISSIONFLAG"));
        tApiXm.setCusitemfullnameCht(jsonObject.getString("CUSITEMFULLNAME_CHT"));
        tApiXm.setParentCode(jsonObject.getString("PARENT_CODE"));
        tApiXm.setParentid(jsonObject.getString("PARENTID"));
        tApiXm.setCusitemcategory(jsonObject.getString("CUSITEMCATEGORY"));
        tApiXm.setTypecode(jsonObject.getString("TYPECODE"));

        return tApiXm;
    }
}
